import React from "react";
import { getEcCom } from '../../util/convert';
import * as _ from '../../util/public/common';

export default class ReqFreeNode extends React.Component{
	constructor(props) {
		super(props);
    }

	render(){
		const {WeaTools,WeaErrorPage} = getEcCom();
		const {freeNode = {}} = this.props;
		let freeNodeHidearea = [];
		if(freeNode){
            const {freeNodeInfo = [],rownum = '',indexnum = '',checkfield = '',freeDuty = ''} = freeNode;
			if(freeNodeInfo){
				freeNodeInfo.map((nodeInfo,key)=>{
					nodeInfo &&  _.forIn(nodeInfo, (v,k)=>{
						freeNodeHidearea.push(<input type="hidden" name={k} value={v||""} />)
					})
				});
			}
			if(rownum){
				freeNodeHidearea.push(<input type="hidden" id="rownum" name="rownum" value={rownum} />);
				freeNodeHidearea.push(<input type="hidden" id="indexnum" name="indexnum" value={indexnum} />);
				freeNodeHidearea.push(<input type="hidden" id="checkfield" name="checkfield" value={checkfield} />);
				freeNodeHidearea.push(<input type="hidden" id="freeNode" name="freeNode" value={freeNode['freeNode']} />);
				freeNodeHidearea.push(<input type="hidden" id="freeDuty" name="freeDuty" value={freeDuty} />);
			}else{
				freeNodeHidearea.push(<input type="hidden" name="freeNode" value="0" />);
			}
		}else{
			freeNodeHidearea.push(<input type="hidden" name="freeNode" value="0" />);
			freeNodeHidearea.push(<input type="hidden" name="freeDuty" value="1" />);
		}
		return (
			<div className="freeNode" style={{"display":"none"}}>
				{freeNodeHidearea}
			</div>
		)
	}
}